<html lang="zh-cn">
<head>
    <title>卡密查询</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
    <div class="container" style="padding-top:70px;">
        <div class="col-md-12 center-block" style="float: none;">
            <div class="panel panel-primary">
                <div class="panel-heading"><h3 class="panel-title">查询卡密</h3></div>
                <div class="panel-body">

                    <?php if(!empty($data)){?>
                    <div class="form-group">
                        <p>颜色说明:
                            <font color='blue'>不存在</font>|
                            <font color='black'>未使用</font>|
                            <font color="#deb887">已使用</font>|
                            <font color='red'>已到期</font>
                        </p>
                        <label>查询结果:</label><br>
                        {foreach $data as $card=>$result }
                            <p> {$card} -- <?php echo $result;?></p>
                        {/foreach}

                    </div>
                    <br/><a href="./">>>返回查询入口</a>
                    <?php }else{?>
                    <form action="./?submit" method="POST">
                        <div class="form-group">
                            <label>输入卡密</label><br>
                            <textarea name="list" rows="10" placeholder="一行一张卡密" class="form-control" required></textarea>
                        </div>
                        <div class="form-group">
                            <label>输入验证码</label><br>
                            <div class="input-group">
                                <input type="text" name="code" class="form-control" value="" placeholder="输入验证码" required>
                                <span class="input-group-addon" style="padding: 0;">
                                    <a href="javascript:void(0)" onClick="document.getElementById('code').src='/index/card_app/code?r='+Math.random()">
                                       <img id="code" style="height: 30px;width: 120px;" border="1" src="/index/card_app/code?r=<?php echo time(); ?>">
                                    </a>
                                </span>
                            </div>
                        </div>
                        <input type="submit" name="submit" class="btn btn-primary btn-block" value="查询">
                    </form>
                    <?php }?>
                </div>
            </div>
        </div>
    </div>
</div>
